package com.ynny.chapter02.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/hello")

public class HelloController {

    private final static Logger logger =
            LoggerFactory.getLogger(HelloController.class);


    @GetMapping
    public Map hello() {

//        logger.trace("hello()->>>>>>>>"+"Hello World!");
//        logger.debug("Hello World!");
//        logger.info("Hello World!");
//        logger.warn("Hello World!");
//        logger.error("Hello World!");

        try {
            int i = 1/0;
        }catch (Exception e){

            logger.error("Hello World!",e);

        }


        HashMap map = new HashMap();
        map.put("message", "Hello World!");
        return map;
    }
}
